package Lee_code;

import java.util.HashSet;
import java.util.jar.JarFile;
import java.util.stream.Collectors;

/**
 * @author blh
 * @date 2024年08月14日 21:10
 */
public class Lee_260_814 {
    public int[] singleNumber(int[] nums) {
        HashSet<Integer> seen = new HashSet<>(2);
        for (int num : nums) {
            if (seen.contains(num)) {
                seen.remove(num);
            } else {
                seen.add(num);
            }
        }
        return seen.stream().mapToInt(Integer::intValue).toArray();
    }
}
